<template>
  <view class="content">
    <image class="logo" @click="changeLang" src="/static/logo.png"></image>
    <view @click="changeLang('zh')">切换成中文</view>
    <view @click="changeLang('en')">切换成英文</view>
    <view class="text-area">{{ title }}</view>
  </view>
</template>
<script>
import { getDemo } from '@/request/api/demo';
export default {
  data() {
    return {
      title: this.$t('locale.auto')
    };
  },
  onLoad() {
    this.getDemo();
  },
  methods: {
    changeLang(local) {
      uni.setLocale(local);
    },
    async getDemo() {
      try {
        let res = await getDemo();
        console.log(res);
      } catch (e) {
        console.log(e, 123123);
      }
    }
  }
};
</script>

<style></style>
